package com.ybb.controller;

import com.ybb.account.entity.UserEntity;
import com.ybb.account.mapper.UserMapper;
import com.ybb.account.service.UserAccountService;
import com.ybb.account.vo.EnchargeVo;
import com.ybb.common.configuration.response.RetResponse;
import com.ybb.common.configuration.response.RetResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class UserController {

    @Autowired
    private UserAccountService userService;

    /**
     * 用户充值
     */
    @PostMapping("/api/user/account/{code}/recharge")
    public RetResult enchargeAccount(@PathVariable("code") String code ,@RequestBody EnchargeVo encharge){
        userService.enchargeAccount( code, encharge.getAmount());
        return RetResponse.makeOKRsp("充值成功");
    }
}
